package red.lixiang.service;

import red.lixiang.model.BaseInfo;
import red.lixiang.model.Product;
import red.lixiang.model.ProductAttribute;
import org.springframework.stereotype.Service;

import java.util.function.Function;

@Service
public interface ProductService {
    BaseInfo getProductByBarCode(String barCode);

    BaseInfo getProductByProductId(String productId);


    BaseInfo getProductImageByProductId(String productId);

    BaseInfo deleteProductImageById(String id);

    /**
     *只考虑切换颜色的时候才请求
     * @param productId
     * @param selectType 0：颜色  1：尺码
     * @param selectValue
     * @return
     */
    BaseInfo changeProductAttribute(String productId,int selectType,String  selectValue);

    BaseInfo getProductByPage(int currentPage , int numPerPage);

    BaseInfo getProductDescByProductId(String productId);

    Function<Product, ProductAttribute> getProductAttr = (Product product  )->{
        ProductAttribute productAttribute = new ProductAttribute();
        productAttribute.setColorCode(product.getColorCode());
        productAttribute.setColorName(product.getColorName());
        productAttribute.setSizeCode(product.getSizeCode());
        productAttribute.setSizeName(product.getSizeName());
        return productAttribute;
    };

}
